package com.yf.dxapp.module.app.dal.mysql.behavior;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.yf.dxapp.module.app.controller.admin.behavior.vo.BehaviorPageReqVO;
import com.yf.dxapp.module.app.dal.dataobject.behavior.BehaviorDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 行为记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BehaviorMapper extends BaseMapperX<BehaviorDO> {

    default PageResult<BehaviorDO> selectPage(BehaviorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BehaviorDO>()
                .eqIfPresent(BehaviorDO::getType, reqVO.getType())
                .eqIfPresent(BehaviorDO::getRefId, reqVO.getRefId())
                .eqIfPresent(BehaviorDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BehaviorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BehaviorDO::getId));
    }

}